import React, { Component } from 'react';
// import { Ellipsis } from 'antd-mobile'
import { withRouter } from 'react-router-dom';
import './Killpros.scss'
import pro from '../../api/index'
interface State {
    count: number
    killpros: any
}
interface KillPros {
    state: State
}
class KillPros extends Component<any,any> {

    constructor(props: any) {
        super(props)
        this.state = {
            count: 1,
            killpros: []
        }
    }
    componentDidMount(): void {
        pro.pro.getKillpros({ count: this.state.count, limitNum: 8 }).then(res => {
            // console.log(res)
            this.setState({
                killpros: res.data.data
            })
        })
    }
    toDetails(proid: string) {
        this.props.history.push("/details/" + proid)
    }
    render() {
        return (
            <div className='killpros'>
                <div className="time">
                    <span>嗨购秒杀</span>

                    <span>爆款轮番秒</span>
                </div>
                <div className="killpro">
                    {this.state.killpros.map((item: any) => {
                        return (
                            <div className="pro" key={item.proid} onClick={()=>{this.toDetails(item.proid)}}>
                                <img src={item.img1} alt="" />
                                <strong>￥{item.originprice}</strong>
                            </div>
                        )
                    })}
                </div>
            </div>
        );
    }
}

export default withRouter(KillPros);